//
//  NSDate+Extension.m
//  TLYunCMS
//
//  Created by mac on 2016/11/30.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "NSDate+Extension.h"
#import "NSString+Extension.h"

@implementation NSDate (Extension)

//将时间戳转换为NSDate类型
+(NSDate *)getDateFromMilliSec:(NSInteger)miliSec
{
    NSTimeInterval tempMilli = miliSec/1000;
    NSTimeInterval seconds = tempMilli;
//    NSLog(@"seconds=%f",seconds);
    return [NSDate dateWithTimeIntervalSince1970:seconds];
}

- (NSString *)stringWithFormat:(NSString *)format
{
    NSDateFormatter *formatter = [NSDateFormatter fs_sharedDateFormatter];
    formatter.dateFormat = format;
    return [formatter stringFromDate:self];
}
- (NSString *)stringWithFormatDefult {
    NSString *date = [self stringWithFormat:@"YYYY-MM-dd HH:mm:ss"];
    return date;
}

@end
